#!/sbin/runscript
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.

description="Executes user programs in ~/local.d"

depend()
{
	after *
	keyword -timeout
}

start()
{
	einfo "Starting local"

	local user
	local file
	for user in /home/* ; do
		for file in ${user}/local.d/*.start ; do
			[ -x "$file" ]  && su ${user/#"/home/"/} -c "\"$file\""
		done
	done

	eend 0
}

stop()
{
	einfo "Stopping local"

	local user
	local file
	for user in /home/* ; do
		for file in ${user}/local.d/*.stop ; do
			[ -x "$file" ]  && su ${user/#"/home/"/} -c "\"$file\""
		done
	done

	eend 0
}
